import request from '@/utils/request'

/**
 * 获取搜索的联想建议
 * @param {String} q 搜索关键字
 */
export const getSearchSuggestion = q => {
  return request({
    method: 'GET',
    url: '/app/v1_0/suggestion',
    params: {
      q
    }
  })
}

/**
 *
 * @param {String} q 搜索关键字
 * @param {Number} page 页数，可不传，默认1
 * @param {Number} per_page 每页数量，不传每页数量由后端决定
 */
export const getSearchResult = (q, page, perPage) => {
  return request({
    method: 'GET',
    url: '/app/v1_0/search',
    params: {
      q,
      page,
      per_page: perPage
    }
  })
}
